package com.ruoyi.common.sms.aliyun;

import lombok.Data;

import java.io.Serializable;

/**
 * 短信发送结果
 */
@Data
public class SmsResult implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 是否成功
     */
    private boolean success;

    /**
     * 返回消息
     */
    private String message;

    /**
     * 请求ID
     */
    private String requestId;

    /**
     * 业务ID
     */
    private String bizId;

    /**
     * 错误代码
     */
    private String code;

    public SmsResult() {}

    public SmsResult(boolean success, String message) {
        this.success = success;
        this.message = message;
    }

    public static SmsResult success(String message, String requestId, String bizId) {
        SmsResult result = new SmsResult();
        result.setSuccess(true);
        result.setMessage(message);
        result.setRequestId(requestId);
        result.setBizId(bizId);
        return result;
    }

    public static SmsResult error(String message, String code, String requestId) {
        SmsResult result = new SmsResult();
        result.setSuccess(false);
        result.setMessage(message);
        result.setCode(code);
        result.setRequestId(requestId);
        return result;
    }
}